package com.zhentao.day07;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;

public class ArraysTest {
  public static void main(String[] args) throws Exception {

    try {
      System.out.println(10 / 0);
    } catch (ArithmeticException e){

        System.out.println("e = " + e);

    }



    /*ArrayList<String> list = new ArrayList<>();
    int i = 0;
    while(true){
      i++;
      list.add(i+"");
      System.out.println("i + " + list);
    }*/
    /*Calendar instance = Calendar.getInstance();
    System.out.println("instance.get(1) = " + instance.get(1));
    System.out.println("instance.get(1) = " + instance.get(Calendar.YEAR));
    System.out.println("instance.get(1) = " + (instance.get(Calendar.MONTH) + 1 ) );*/

    /*String pattern = "y年M月d日H时m分s秒";  // 转换的格式
    DateFormat format = new SimpleDateFormat(pattern);
    // String dateStr = "2024-08-31 09:15:37"; // 转换的时间字符串
    String dateStr = "2024年08月31日09时15分37秒"; // 转换的时间字符串 必须与格式字符串一致

    Date date = format.parse(dateStr); // ParseException  转换异常
    System.out.println("date = " + date);*/


    /*Date date = new Date();
    System.out.println("date = " + date);
    System.out.println("date.getTime() = " + date.getTime());
    String str = "yyyy-MM-dd HH:mm:ss";
    DateFormat format = new SimpleDateFormat(str); // 1725066937729

    Date date1 = new Date(1725066937729L); // long 值所代表的时间

    String formatStr = format.format(date1);

    System.out.println("formatStr = " + formatStr);*/



    /*Random r = new Random();
    int i = r.nextInt(91) + 5 ;  // 5 ~ 95    0 ~ 90
    int i1 = r.nextInt(5,96) ;  // 5 ~ 95    0 ~ 90
    System.out.println("i = " + i);*/

    // double d = Math.random();
    // int i = (int) (d*100 *100);
    // double b = i/100.0;
    // System.out.println("d = " + b);

    /*double d = -1.50 ;
    System.out.println("d = " + d);
    System.out.println("Math.ceil(d) = " + Math.ceil(d));
    System.out.println("Math.floor(d) = " + Math.floor(d));
    System.out.println("Math.round(d) = " + Math.round(d));*/


    // int is [] = new int[] {1,2,88,3,54,53,52,51,99};
    //

    // Arrays.sort(is);

    // 二分查找法, 查找指定的值
    // int i = Arrays.binarySearch(is,3);

    // System.out.println("Arrays.toString(is) = " + i);


  }
}
